Skip to main content

Sugar - Infrared Receiver

Function


To accept and process signals from infrared remote controllers

Signal:Timing Signal

Module Principle

Key value data corresponding to infrared remote control emission

红外遥控器.jpeg

ff005da2ff009d62ff001de2
ff00dd22ff00fd02ff003dc2
ff001fe0ff0057a8ff003dc2
ff009768ff006798ff006f90
ff00cf30ff00e718ff00857a
ff00ef10ff00c738ff00a55a
ff00bd42ff00b54aff00ad52

Wiring

Futureboard Lite mainboard 3 - 副本.png

Futureboard Lite interfaceUse wire
Sugar cube infrared receiving module.pngInfrared remote controlPort3White PH2.0-3Pin interface cableuntitled.100.png

warning Supported connection to Port1、Port2、Port3、Port4 Be sure the interface is consistent with the actual situation while programming.

Blocks - Function Description

NumberBlock ImageBlock Function
1image-20240315153821192Read key values from the remote controller

Program 1 - Full Program

image-20240315155627199

Program 1 - Function Description

danger

Set the color screen to dot matrix mode, initialize the variable to 1 image-20240315155658262

danger

Read the infrared remote control emission data image-20240315155715581:::

When there is data, x is true, otherwise it is false When the data is true, then make a judgment, if it is ff005da2, it corresponds to the infrared remote control Multiply the variable of the flag by negative one, the flag variable after this operation, there are always only two possible values, -1 or 1 image-20240315155730174 :::

info

By judging whether the flag variable is 1, it can be processed in two cases, if it is 1, the big heart will be displayed, if it is -1, the small heart will be displayed This usage can be extended to other scenarios, such as turning on lights, turning on motors image-20240315155740332

Program 2 - a complete program

blocksPng-1710491007478

Program 2- Functional Description

danger

Initializes RGB settings and related color screen configurations blocksPng-1710490840647

danger

Reads data from the infrared remote control; if there is data, proceed to the next stepblocksPng-1710490860314

info

Judges the read data; if it is ff00fd02, increases the brightness variable by 10; if the value exceeds 100, resets it blocksPng-1710490908800

danger

Judges the read data; if it is ff006798, decreases the brightness variable by 10; if the value is less than 0, resets it blocksPng-1710490933419

info

Controls the brightness of the colored light and displays the brightness value on the color screen

Using KittenBlock

Run the program offline to view the effect

Using on Microbit

Robotbit_compressed.png

Programming Platform

Microsoft MakeCode for micro:bit Use Makecode programming platform

Add the Sugar Plug-in

image-20240311154521941image.png Search for Sugar in the extensions, click Add

Circuit connection

image.png